package com.lu.task.service;

import com.lu.common.utils.PageUtils;
import com.lu.system.management.domain.UserDO;
import com.lu.task.domain.TaskDO;
import org.quartz.SchedulerException;

import java.util.List;
import java.util.Map;

/**
 * 
 * 
 * @author showlu
 * @email 1309617271@qq.com
 * @date 2018-08-16 18:55:10
 */
public interface TaskService {
	
	TaskDO get(Long id);
	
	List<TaskDO> list(Map<String, Object> map);
	
	int count(Map<String, Object> map);
	
	int save(TaskDO task);

    void saveBatch(List<TaskDO> task) throws Exception;
	
	int update(TaskDO task);

    void updateBatch(List<TaskDO> task) throws Exception;
	
	int remove(Long id);
	
	int batchRemove(Long[] ids);

	void initSchedule() throws SchedulerException;

	//暂停与恢复任务 cmd: stop ; start
	void changeStatus(Long jobId, String cmd) throws SchedulerException;

	//更新job时间表达式
	void updateCron(Long jobId) throws SchedulerException;

	PageUtils getTaskList(Map<String, Object> map, Integer page, Integer limit) throws Exception;

	//新增 如果状态是1，则加到定时任务中
	Integer saveJob(TaskDO taskDO,UserDO userDO) throws Exception;

	//修改任务 -> 暂停与恢复任务
	Integer updateJob(TaskDO taskDO) throws Exception;

	//删除任务
	Integer removeJob(Long id) throws Exception;
}
